#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2025/1/5 5:18
# @Author : George
from flask import Blueprint, render_template, session
from ..db import fetch_all
from flask_work.func.common import update_status

# 创建蓝图
admin = Blueprint('admin', __name__)


@admin.route('/admin/staff')
def staff():
    sql = "SELECT * FROM users"
    user_dict = fetch_all(sql, ())
    user_info = session.get("user_info")
    return render_template("admin_staff.html", user_dict=user_dict, user_info=user_info)


@admin.route('/admin/upload')
def upload():
    user_info = session.get("user_info")
    sql = "select * from project"
    project_dict = fetch_all(sql, ())
    project_list = [project["project_name"] for project in project_dict]
    sql = "SELECT * FROM team"
    team_dict = fetch_all(sql, ())
    team_list = [team["team_name"] for team in team_dict]
    return render_template("admin_upload.html", user_info=user_info, project_list=project_list, team_list=team_list)
